package org.example.mapper;

import org.apache.ibatis.annotations.*;
import org.example.pojo.Orders;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface OrderMapper {

    @Select("select * from orders where id=#{id}")
    @Results({
            @Result(column = "user_id",property = "user",
                    one = @One(select = "org.example.mapper.UserMapper.selectById2"))
    })
    Orders selectById(Integer id);
    @Select("select * from orders where user_id = #{id}")
    List<Orders> selectByuUserId(Integer id);

    @Select("select * from orders")
    @Results({
            @Result(column = "id" ,property = "orderdetailList",
            many = @Many(select = "org.example.mapper.OrdersdetailMapper.selectByOrdersId"  ))
    })
    List<Orders> findAll();



}
